package com.lm.geodesy.example;

import org.gavaghan.geodesy.Ellipsoid;
import org.gavaghan.geodesy.GeodeticCalculator;
import org.gavaghan.geodesy.GeodeticCurve;
import org.gavaghan.geodesy.GlobalCoordinates;

public class BearingExample {
    public static void main(String[] args) {
        GlobalCoordinates pointA = new GlobalCoordinates(34.052235, -118.243683); // 洛杉矶
        GlobalCoordinates pointB = new GlobalCoordinates(40.712776, -74.005974); // 纽约

        GeodeticCalculator calculator = new GeodeticCalculator();
        Ellipsoid reference = Ellipsoid.WGS84;

        // 计算方位角
        GeodeticCurve curve = calculator.calculateGeodeticCurve(reference, pointA, pointB);
        double azimuth = curve.getAzimuth();

        System.out.println("洛杉矶到纽约的方位角: " + azimuth + " 度");
    }
}

